package com.smartian.scan.filesearch.bean;

import java.io.File;

public class PathFile {

    private File file;
    private StringPath path;

    public static PathFile build(File file, String path) {
        return build(file,new StringPath(path));
    }

    public static PathFile build(File file, StringPath path) {

        PathFile pathFile = new PathFile();
        pathFile.setFile(file);
        pathFile.setPath(path);

        return pathFile;
    }


    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file .getAbsoluteFile();
    }

    public void setPath(StringPath path) {
        this.path = path;
    }

    public File getAbsoluteFile(){
       return this.file.getAbsoluteFile();
    }

    public String getAbsolutePath(){
        return this.file.getAbsolutePath();
    }

    public String getName(){
        return this.file.getName();
    }

    public boolean exists(){
        return this.file.exists();
    }

    public File getParentFile(){
        return this.file.getParentFile();
    }

    public boolean isFile(){
        return this.file.isFile();
    }

    public boolean isDirectory(){
        return this.file.isDirectory();
    }

    public boolean isHidden(){
        return this.file.isHidden();
    }

    public boolean isAbsolute(){
        return this.file.isAbsolute();
    }

    public long lastModified(){
         return this.file.lastModified();
    }

    public boolean setLastModified(long time){
        return this.file.setLastModified(time);
    }

    public long getTotalSpace( ){
        return this.file.getTotalSpace();
    }

    public long length( ){
        return this.file.length();
    }

    public void setReadable( boolean isReadable){
         this.file.setReadable(isReadable);
    }

    public void setWritable( boolean isReadable){
        this.file.setWritable(isReadable);
    }

    public StringPath getStringPath() {
        return path;
    }

    public String getDirPath() {
        return path.getFullPath();
    }
}
